import request from '@/utils/request';



export async function pageCasePlan(projectId, qaItemId, params) {
    return request(`/project/${projectId}/qaItem/${qaItemId}/casePlan/page`, {
        params,
    });
}

export async function save(projectId, qaItemId, data) {
    return request(`/project/${projectId}/qaItem/${qaItemId}/casePlan`, {
        method: "POST",
        data: data
    });
}

export async function update(projectId, qaItemId, casePlanId, data) {
    return request(`/project/${projectId}/qaItem/${qaItemId}/casePlan/${casePlanId}`, {
        method: "POST",
        data: data
    });
}

export async function getDetail(projectId, qaItemId, casePlanId) {
    return request(`/project/${projectId}/qaItem/${qaItemId}/casePlan/${casePlanId}`);
}

export async function getBrief(projectId, qaItemId, casePlanId) {
    return request(`/project/${projectId}/qaItem/${qaItemId}/casePlan/brief/${casePlanId}`);
}

export async function updateCaseIds(projectId, qaItemId, casePlanId, caseIds) {
    return request(`/project/${projectId}/qaItem/${qaItemId}/casePlan/${casePlanId}/updateCaseIds`, {
        method: "POST",
        data: {
            caseIds: caseIds
        }
    });
}

export async function completeCasePlanDetail(projectId, qaItemId, casePlanId, casePlanDetailId, data) {
    return request(`/project/${projectId}/qaItem/${qaItemId}/casePlan/detail/${casePlanId}/${casePlanDetailId}/complete`, {
        method: "POST",
        data: data
    });
}

export async function deleteCasePlanDetail(projectId, qaItemId, casePlanId, casePlanDetailId) {
    return request(`/project/${projectId}/qaItem/${qaItemId}/casePlan/detail/${casePlanDetailId}`, {
        method: "DELETE",
    });
}